<%@page import="messages.SystemMessage"%>
<jsp:include page="part/header.jsp" />

		<div data-role="header">
            <h1>Login</h1>
        </div>
 
        <div data-role="content">
            <form id="login">
                <div data-role="fieldcontain">
                    <label for="username">Username</label>
                    <input type="text" name="username" id="username" value=""  />
 
                    <label for="pswd">Password</label>
                    <input type="text" name="pswd" id="pswd" value=""  />
                    <h3 id="notification"></h3>
                    <button id="submit" type="submit" >Submit</button>                    
                </div>
            </form>
        </div>
        
        
<script>

$(function() {

	$("#submit").click(function() {
	var vuser = $.trim($("#username").val());
	var vpsw = $.trim($("#pswd").val());
	
	
		if(validate()){			
			$.ajax({
			type: "POST",
			url: "<%= request.getContextPath() %>/ajax/loginAjax.jsp",
			data: ({username: vuser,password: vpsw}),
			cache: false,
			dataType: "text",
			success: onSuccess
			});			
		}
	});
	
	function onSuccess(data)
	{	
		//if data...
		window.location.href = "menu.jsp?__DET_ID=1";
	}
	function validate()
	{
		return true;
	}
});



</script>
<jsp:include page="part/footer.jsp" />	